{
 "cells": [
  {
   "cell_type": "markdown",
   "id": "improved-liabilities",
   "metadata": {},
   "source": [
    "# Interdigitated Transmon Qubits"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "looking-velvet",
   "metadata": {},
   "source": [
    "This demo notebook goes over how to use the interdigitated transmon component, similar to those describedin Gambetta et. al., IEEE Trans. on Superconductivity Vol. 27, No. 1 (2007). \n",
    "\n",
    "First, let's import the key libraries for qiskit metal: "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "attached-report",
   "metadata": {},
   "outputs": [],
   "source": [
    "# Demo notebook for interdigitatd transmon qubit design \n",
    "import qiskit_metal as metal\n",
    "from qiskit_metal import designs, draw\n",
    "from qiskit_metal import MetalGUI, Dict #, open_docs"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "continuing-tourism",
   "metadata": {},
   "source": [
    "Next, let's fire up the GUI: "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "crazy-possibility",
   "metadata": {},
   "outputs": [],
   "source": [
    "design = designs.DesignPlanar()\n",
    "gui = MetalGUI(design)"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "executed-childhood",
   "metadata": {},
   "source": [
    "The name of the component located in the qlibrary is \"Transmon_Interdigitated\" and we can take a look at the various input options:"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "animal-speech",
   "metadata": {},
   "outputs": [],
   "source": [
    "from qiskit_metal.qlibrary.qubits.Transmon_Interdigitated import TransmonInterdigitated\n",
    "TransmonInterdigitated.default_options"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "descending-municipality",
   "metadata": {},
   "source": [
    "Now let's create three transmons, each centered at a specific (x,y) coordinate: "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "composed-parallel",
   "metadata": {},
   "outputs": [],
   "source": [
    "from qiskit_metal.qlibrary.qubits.Transmon_Interdigitated import TransmonInterdigitated\n",
    "design.overwrite_enabled = True\n",
    "q1 = TransmonInterdigitated(design, 'qubit1', options=dict(pos_x='-2.0mm',orientation='-90'))\n",
    "gui.rebuild()\n",
    "gui.autoscale()\n",
    "gui.zoom_on_components(['qubit1']) #Can also gui.zoom_on_components([q1.name])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "elementary-thinking",
   "metadata": {},
   "outputs": [],
   "source": [
    "#Save screenshot as a .png formatted file.\n",
    "gui.screenshot()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "related-witch",
   "metadata": {
    "tags": [
     "nbsphinx-thumbnail"
    ]
   },
   "outputs": [],
   "source": [
    "# Screenshot the canvas only as a .png formatted file.\n",
    "gui.figure.savefig('shot.png')\n",
    "\n",
    "from IPython.display import Image, display\n",
    "_disp_ops = dict(width=500)\n",
    "display(Image('shot.png', **_disp_ops))"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "renewable-breath",
   "metadata": {},
   "source": [
    "## Closing the Qiskit Metal GUI"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "sporting-toner",
   "metadata": {},
   "outputs": [],
   "source": [
    "gui.main_window.close()"
   ]
  }
 ],
 "metadata": {
  "celltoolbar": "Tags",
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.7.8"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
